<script>
$(document).ready(function(){
    $('#total').change(function(){
        
        if(this.checked){
            
            $('.item').attr('checked',true);
        }else{
             $('.item').attr('checked',false);
        }
        
    });
    
   
})

</script>

<?php if (isset($parametros)):?>
        <table border="1">
        <thead>
            <tr>
                <th>Parametros de la acción</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
           <?php  foreach ($parametros as $parametro): ?>
            <tr>
                <td><?php  echo $parametro; ?></td>
                <td><?php echo $this->Form->checkbox("Parametro.$parametro",array( 'hiddenField' => false,'value'=>$parametro)); ?></td>
            </tr>
            <?php endforeach ;?>
        </tbody>
    </table>

<?php endif ;?>
<?php if (isset($parametros)):?>
        <table border="1">
        <thead>
            <tr>
                <th>Enviar lista al controlador</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
           <?php  foreach ($parametros as $parametro): ?>
            <tr>
                <td><?php  echo $parametro; ?></td>
                <td><?php echo $this->Form->checkbox("",array('name'=>"lista[]",'hiddenField' => false,'value'=>$parametro)); ?></td>
            </tr>
            <?php endforeach ;?>
        </tbody>
    </table>

<?php endif ;?>


<?php if (isset($campos)):?>
        <table border="1">
        <thead>
            <tr>
                <th>Campo a llamar en la variable fields</th>
                <th><?php echo $this->Form->input('Selecionar todos', array(
                        'type' => 'checkbox',
                        'id'=>'total'
                    ));?></th>
                
               
            </tr>
        </thead>
        <tbody>
           <?php  foreach ($campos as $campo): ?>
            <tr>
                <td><?php  echo $campo["COLUMNS"]["Field"]; ?></td>
                <td><?php echo $this->Form->checkbox("Campos.$objeto.".$campo["COLUMNS"]["Field"],array('class'=>'item','hiddenField' => false,'value'=>$campo["COLUMNS"]["Field"])); ?></td>
            </tr>
            <?php endforeach ;?>
        </tbody>
    </table>

<?php endif ;?>
